<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>修改员工信息页面</title>
    <link rel="stylesheet" type="text/css" href="../../static/admin/layui2/css/layui.css"/>
</head>
<body class="layui-layout-admin" >
        <div class="layui-anim layui-anim-scale">
            <form class="layui-form layui-form-pane" name="form1" id="form1" style="margin-top: 20px;">
                <div class="layui-form-item">
                    <label class="layui-form-label">员工号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="yuangongHao" id="yuangongHao" class="layui-input" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="xinming" id="xinming" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-block">
                        <input type="radio" name="xinbie" id="nan" value="1" title="男">
                        <input type="radio" name="xinbie" id="nu" value="0" title="女">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">所在部门</label>
                    <div class="layui-input-block">
                        <input type="text" name="suozaiBumem" id="suozaibumem" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">手机</label>
                    <div class="layui-input-block">
                        <input type="text" name="shouji" id="shouji" autocomplete="off" class="layui-input" lay-verify="required" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">工作电话</label>
                    <div class="layui-input-block">
                        <input type="text" name="gongzuoDianhua" id="gongzuoDianhua" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">学历</label>
                    <div class="layui-input-inline">
                        <select name="xueli" id="xueli">
                            <option value="中专">中专</option>
                            <option value="大专">大专</option>
                            <option value="本科">本科</option>
                            <option value="硕士">硕士</option>
                            <option value="博士">博士</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">入行时间</label>
                    <div class="layui-input-inline">
                        <input type="text" name="ruhangShijian" id="ruhangShijian" lay-verify="date" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">身份证号</label>
                    <div class="layui-input-block">
                        <input type="text" name="shengfenZhenghao" id="shengfenZhenghao" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">银行卡号</label>
                    <div class="layui-input-block">
                        <input type="text" name="yinhangKahao" id="yinhangKahao" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">地址</label>
                    <div class="layui-input-block">
                        <input type="text" name="dizhi" id="dizhi" autocomplete="off" class="layui-input" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">修改</button>
                    </div>
                </div>
            </form>
        </div>
</div>
<script src="../../static/admin/layui2/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['element','form','jquery','layer','laydate'], function() {
        var element = layui.element
        var form = layui.form
        laydate = layui.laydate
        layer = layui.layer
        $ = layui.jquery;

        laydate.render({
            elem: '#ruhangShijian'
        });

        form.on('submit(demo1)',function(data){
            $.ajax({
                type:"POST",
                url:"/guanliyuan/updataYuangong",
                data:{
                    "yuangongHao": data.field.yuangongHao,
                    "xinming": data.field.xinming,
                    "xinbie": data.field.xinbie,
                    "suozaiBumem": data.field.suozaiBumem,
                    "shouji":data.field.shouji,
                    "gongzuoDianhua":data.field.gongzuoDianhua,
                    "xueli":data.field.xueli,
                    "ruhangShijian":data.field.ruhangShijian,
                    "shengfenZhenghao":data.field.shengfenZhenghao,
                    "yinhangKahao":data.field.yinhangKahao,
                    "dizhi":data.field.dizhi,
                },
                dataType:"json",
                success:function (res) {
                    if (res.flag) {
                        layer.msg('修改成功！',{icon:6,offset:"auto",time:2000});//提示框,提示2秒自动消失
                    }else  {
                        layer.msg('修改失败！',{icon:5,offset:"auto",time:2000});//提示框
                    }
                    setTimeout(function(){
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);//关闭弹出层
                        parent.location.reload();//重新加载父页面表格
                    }, 2100);
                }
            })
            return false;
        });
    });
</script>
</body>
</html>